home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 8: LINUX Games / Linux Cubed Series 8 - LINUX Games.iso / games / actionrp / color-ne.tgz / color-ne.tar / nethack-3.1.3-linux.diff
Text File  |  1996-03-25  |  11KB  |  367 lines

  1. The following diff includes config options set in this version, for your
  2. reference. A few patches are included to add the console-auto-detection,
  3. and the automatic turn-on of graphics and color for it. In order to get
  4. it compiled with the VPIX_MUSIC option enabled, you need to copy the
  5. 'interp.c' from 'sys/unix/snd86unx.shr' included in the nethack source
  6. archive to the 'src' dir.
  7. I'm not certain, but I think the KDMKTONE feature it uses was added in
  8. a later 1.3 kernel, so you might need a current 1.3 kernel if you want to
  9. have sound.
  10. You might also need to chose another compiler version in the Makefiles,
  11. since it is not likely that you system has the pentium-gcc 2.7.2p installed.
  12.  
  13. Enjoy
  14.  
  15. Andreas Arens
  16.  
  17. diff -ur nethack-3.1.3/include/config.h nethack-3.1.3-linux/include/config.h
  18. --- nethack-3.1.3/include/config.h    Tue Jul 20 18:28:26 1993
  19. +++ nethack-3.1.3-linux/include/config.h    Mon Mar 25 13:38:48 1996
  20. @@ -261,12 +261,12 @@
  21.  
  22.  #ifdef UNIX
  23.  /* path and file name extension for compression program */
  24. -# define COMPRESS "/usr/ucb/compress"         /* Lempel-Ziv compression */
  25. -# define COMPRESS_EXTENSION ".Z"         /* compress's extension */
  26. +/* # define COMPRESS "/usr/ucb/compress"         /* Lempel-Ziv compression */
  27. +/* # define COMPRESS_EXTENSION ".Z"         /* compress's extension */
  28.  
  29.  /* An example of one alternative you might want to use: */
  30. -/* # define COMPRESS "/usr/local/bin/gzip"   /* FSF gzip compression */
  31. -/* # define COMPRESS_EXTENSION ".gz"         /* normal gzip extension */
  32. +# define COMPRESS "/bin/gzip"   /* FSF gzip compression */
  33. +# define COMPRESS_EXTENSION ".gz"         /* normal gzip extension */
  34.  #endif
  35.  #ifndef COMPRESS
  36.  # define INTERNAL_COMP    /* control use of NetHack's compression routines */
  37. @@ -297,7 +297,7 @@
  38.   * since the user might create files in a directory of his choice.
  39.   * Of course SECURE is meaningful only if HACKDIR is defined.
  40.   */
  41. -/* #define SECURE    /* do setuid(getuid()) after chdir() */
  42. +#define SECURE    /* do setuid(getuid()) after chdir() */
  43.  
  44.  /*
  45.   * If it is desirable to limit the number of people that can play Hack
  46. @@ -388,9 +388,9 @@
  47.   * functions that have been macroized.
  48.   */
  49.  
  50. -/*#define VISION_TABLES    /* use vision tables generated at compile time */
  51. +#define VISION_TABLES    /* use vision tables generated at compile time */
  52.  #ifdef VISION_TABLES
  53. -# define BRACES        /* put braces around rows of 2d arrays */
  54. +# define noBRACES        /* put braces around rows of 2d arrays */
  55.  #else
  56.  # define MACRO_CPATH    /* use clear_path macros instead of functions */
  57.  #endif
  58. diff -ur nethack-3.1.3/include/unixconf.h nethack-3.1.3-linux/include/unixconf.h
  59. --- nethack-3.1.3/include/unixconf.h    Tue Jul 20 18:24:16 1993
  60. +++ nethack-3.1.3-linux/include/unixconf.h    Mon Mar 25 13:00:16 1996
  61. @@ -19,7 +19,7 @@
  62.   */
  63.  
  64.  /* define exactly one of the following four choices */
  65. -#define BSD        /* define for 4.n BSD  */
  66. +/* #define BSD        /* define for 4.n BSD  */
  67.              /* also for relatives like SunOS, Linux and DG/UX */
  68.  /* #define ULTRIX    /* define for Ultrix v3.0 or higher (but not lower) */
  69.              /* Use BSD for < v3.0 */
  70. @@ -34,18 +34,18 @@
  71.  #define NETWORK    /* if running on a networked system */
  72.              /* e.g. Suns sharing a playground through NFS */
  73.  #define SUNOS4    /* SunOS 4.x */
  74. -/* #define LINUX  /* Another Unix clone running on Intel processors */
  75. +#define LINUX  /* Another Unix clone running on Intel processors */
  76.  /* #define GENIX    /* Yet Another Unix Clone */
  77.  /* #define HISX        /* Bull Unix for XPS Machines */
  78.  /* #define BOS        /* Bull Open Software - Unix for DPX/2 Machines */
  79.  /* #define UNIXPC    /* use in addition to SYSV for AT&T 7300/3B1 */
  80.  /* #define AIX_31    /* In AIX 3.1 (IBM RS/6000) use BSD ioctl's to gain
  81.                 job control (note that AIX is SYSV otherwise) */
  82. -/* #define TEXTCOLOR    /* Use System V r3.2 terminfo color support */
  83. +#define TEXTCOLOR    /* Use System V r3.2 terminfo color support */
  84.              /* or ANSI color support on termcap systems */
  85.              /* or X11 color    */
  86. -/* #define POSIX_JOB_CONTROL    /* use System V POSIX job control */
  87. -/* #define POSIX_TYPES    /* use POSIX types for system calls and termios */
  88. +#define POSIX_JOB_CONTROL    /* use System V POSIX job control */
  89. +#define POSIX_TYPES    /* use POSIX types for system calls and termios */
  90.                          /* define for platforms using the GNU libraries */
  91.                          /* linux, etc .. */
  92.  
  93. @@ -65,7 +65,7 @@
  94.  /* see sys/unix/snd86.shr for more information on these */
  95.  /* #define UNIX386MUSIC    /* Play real music through speaker on systems with
  96.                 music driver installed */
  97. -/* #define VPIX_MUSIC    /* Play real music through speaker on systems with
  98. +#define VPIX_MUSIC    /* Play real music through speaker on systems with
  99.                 built-in VPIX support */
  100.  
  101.  
  102. @@ -97,7 +97,7 @@
  103.   * Normally, you shouldn't need to change this.
  104.   * There is currently no port-specific help for Unix systems.
  105.   */
  106. -/* #define PORT_HELP "Unixhelp" */
  107. +#define PORT_HELP "Unixhelp"
  108.  
  109.  /*
  110.   * If you define MAIL, then the player will be notified of new mail
  111. diff -ur nethack-3.1.3/src/music.c nethack-3.1.3-linux/src/music.c
  112. --- nethack-3.1.3/src/music.c    Tue Jul 20 18:27:57 1993
  113. +++ nethack-3.1.3-linux/src/music.c    Mon Mar 25 14:18:04 1996
  114. @@ -623,7 +623,10 @@
  115.  
  116.  #ifdef VPIX_MUSIC
  117.  
  118. -# if 0
  119. +#ifdef __linux__
  120. +#include <sys/kd.h>
  121. +#else
  122. +# if 0    /* SYSV-based IBCS2 system */
  123.  #include <sys/types.h>
  124.  #include <sys/console.h>
  125.  #include <sys/vtkd.h>
  126. @@ -631,9 +634,14 @@
  127.  #define KIOC ('K' << 8)
  128.  #define KDMKTONE (KIOC | 8)
  129.  # endif
  130. +#endif
  131.  
  132.  #define noDEBUG
  133.  
  134. +static void tone();
  135. +static void rest();
  136. +static void speaker();
  137. +
  138.  #include "interp.c"    /* from snd86unx.shr */
  139.  
  140.  static void tone(hz, ticks)
  141. @@ -644,7 +652,11 @@
  142.  # ifdef DEBUG
  143.      printf("TONE: %6d %6d\n",hz,ticks * 10);
  144.  # endif
  145. +#ifdef __linux__
  146. +    usleep(ticks * 10000);
  147. +#else
  148.      nap(ticks * 10);
  149. +#endif
  150.  }
  151.  
  152.  
  153. @@ -652,7 +664,11 @@
  154.  /* rest for given number of ticks */
  155.  int    ticks;
  156.  {
  157. +#ifdef __linux__
  158. +    usleep(ticks * 10000);
  159. +#else
  160.      nap(ticks * 10);
  161. +#endif
  162.  # ifdef DEBUG
  163.      printf("REST:        %6d\n",ticks * 10);
  164.  # endif
  165. diff -ur nethack-3.1.3/sys/unix/Makefile.src nethack-3.1.3-linux/sys/unix/Makefile.src
  166. --- nethack-3.1.3/sys/unix/Makefile.src    Tue Jul 20 18:28:29 1993
  167. +++ nethack-3.1.3-linux/sys/unix/Makefile.src    Mon Mar 25 13:09:24 1996
  168. @@ -91,8 +91,12 @@
  169.  # flags for debugging:
  170.  # CFLAGS = -g -I../include
  171.  
  172. -CFLAGS = -g -I../include
  173. -LFLAGS =
  174. +# CFLAGS = -g -I../include
  175. +# LFLAGS =
  176. +
  177. +CC = gcc -V 2.7.2p
  178. +CFLAGS = -O3 -I../include
  179. +LFLAGS = -s
  180.  
  181.  
  182.  # Set the WINSRC, WINOBJ, and WINLIB lines to correspond to your desired
  183. @@ -127,7 +131,8 @@
  184.  # WINTTYLIB = -ltermcap
  185.  # WINTTYLIB = -lcurses
  186.  # WINTTYLIB = -lcurses16
  187. -WINTTYLIB = -ltermlib
  188. +# WINTTYLIB = -ltermlib
  189. +WINTTYLIB = -lncurses
  190.  #
  191.  # libraries for X11
  192.  WINX11LIB = -lXaw -lXmu -lXext -lXt -lX11
  193. diff -ur nethack-3.1.3/sys/unix/ioctl.c nethack-3.1.3-linux/sys/unix/ioctl.c
  194. --- nethack-3.1.3/sys/unix/ioctl.c    Tue May 11 08:51:14 1993
  195. +++ nethack-3.1.3-linux/sys/unix/ioctl.c    Mon Mar 25 14:55:02 1996
  196. @@ -66,6 +66,10 @@
  197.  extern void NDECL(sco_mapon);
  198.  extern void NDECL(sco_mapoff);
  199.  #endif
  200. +#ifdef __linux__
  201. +extern void NDECL(linux_mapon);
  202. +extern void NDECL(linux_mapoff);
  203. +#endif
  204.  
  205.  #ifdef AUX
  206.  void *
  207. @@ -152,6 +156,9 @@
  208.  #  ifdef _M_UNIX
  209.          sco_mapon();
  210.  #  endif
  211. +#  ifdef __linux__
  212. +        linux_mapon();
  213. +#  endif
  214.          (void) signal(SIGTSTP, SIG_DFL);
  215.  #  ifdef AUX
  216.          ( void ) kill ( 0 , SIGSTOP ) ;
  217. @@ -160,6 +167,9 @@
  218.  #  endif
  219.  #  ifdef _M_UNIX
  220.          sco_mapoff();
  221. +#  endif
  222. +#  ifdef __linux__
  223. +        linux_mapoff();
  224.  #  endif
  225.          resume_nhwindows();
  226.      } else {
  227. diff -ur nethack-3.1.3/sys/unix/setup.sh nethack-3.1.3-linux/sys/unix/setup.sh
  228. --- nethack-3.1.3/sys/unix/setup.sh    Mon Jan 25 18:52:25 1993
  229. +++ nethack-3.1.3-linux/sys/unix/setup.sh    Mon Mar 25 13:04:36 1996
  230. @@ -7,7 +7,7 @@
  231.  # know there's a non-default behavior are assumed to pay enough attention
  232.  # to keep distribution versions if they modify things.
  233.  
  234. -if [ $# -gt 0 ] ; then
  235. +if [ 1 ] ; then
  236.  #    First, try to make a symbolic link.
  237.  #
  238.      ln -s Makefile.top Makefile >/dev/null 2>&1
  239. diff -ur nethack-3.1.3/sys/unix/unixmain.c nethack-3.1.3-linux/sys/unix/unixmain.c
  240. --- nethack-3.1.3/sys/unix/unixmain.c    Sun Apr 25 19:16:54 1993
  241. +++ nethack-3.1.3-linux/sys/unix/unixmain.c    Mon Mar 25 12:56:59 1996
  242. @@ -30,6 +30,10 @@
  243.  extern void NDECL(check_sco_console);
  244.  extern void NDECL(init_sco_cons);
  245.  #endif
  246. +#ifdef __linux__
  247. +extern void NDECL(check_linux_console);
  248. +extern void NDECL(init_linux_cons);
  249. +#endif
  250.  
  251.  int
  252.  main(argc,argv)
  253. @@ -95,11 +99,17 @@
  254.  #ifdef _M_UNIX
  255.      check_sco_console();
  256.  #endif
  257. +#ifdef __linux__
  258. +    check_linux_console();
  259. +#endif
  260.      initoptions();
  261.      init_nhwindows();
  262.      exact_username = whoami();
  263.  #ifdef _M_UNIX
  264.      init_sco_cons();
  265. +#endif
  266. +#ifdef __linux__
  267. +    init_linux_console();
  268.  #endif
  269.  
  270.      /*
  271. diff -ur nethack-3.1.3/sys/unix/unixtty.c nethack-3.1.3-linux/sys/unix/unixtty.c
  272. --- nethack-3.1.3/sys/unix/unixtty.c    Sun Apr 25 19:16:55 1993
  273. +++ nethack-3.1.3-linux/sys/unix/unixtty.c    Mon Mar 25 15:02:11 1996
  274. @@ -365,6 +365,58 @@
  275.  #endif    /* _M_UNIX */
  276.  
  277.  
  278. +
  279. +#ifdef __linux__
  280. +#include <sys/vt.h>
  281. +int sco_flag_console = 0;    /* Fake, to ease porting */
  282. +
  283. +void
  284. +linux_mapon()
  285. +{
  286. +# ifdef TTY_GRAPHICS
  287. +    if (!strcmp(windowprocs.name, "tty") && sco_flag_console) {
  288. +        write(1,"\033(B",3);
  289. +    }
  290. +# endif
  291. +}
  292. +
  293. +void
  294. +linux_mapoff()
  295. +{
  296. +# ifdef TTY_GRAPHICS
  297. +    if (!strcmp(windowprocs.name, "tty") && sco_flag_console) {
  298. +        write(1,"\033(U",3);
  299. +    }
  300. +# endif
  301. +}
  302. +
  303. +void
  304. +check_linux_console()
  305. +{
  306. +        struct vt_mode vtm;
  307. +
  308. +    if (isatty(0) && ioctl(0,VT_GETMODE,&vtm) >= 0) {
  309. +        sco_flag_console = 1; 
  310. +    }
  311. +}
  312. +
  313. +void
  314. +init_linux_console()
  315. +{
  316. +# ifdef TTY_GRAPHICS
  317. +    if (!strcmp(windowprocs.name, "tty") && sco_flag_console) {
  318. +        atexit(linux_mapon);
  319. +        linux_mapoff();
  320. +        switch_graphics(IBM_GRAPHICS);
  321. +        if (has_colors())
  322. +            flags.use_color = TRUE;
  323. +    }
  324. +# endif
  325. +}
  326. +#endif    /* __linux__ */
  327. +
  328. +
  329. +
  330.  /* fatal error */
  331.  /*VARARGS1*/
  332.  
  333. diff -ur nethack-3.1.3/sys/unix/unixunix.c nethack-3.1.3-linux/sys/unix/unixunix.c
  334. --- nethack-3.1.3/sys/unix/unixunix.c    Tue Jul 20 18:28:30 1993
  335. +++ nethack-3.1.3-linux/sys/unix/unixunix.c    Mon Mar 25 14:59:37 1996
  336. @@ -20,6 +20,10 @@
  337.  extern void NDECL(sco_mapon);
  338.  extern void NDECL(sco_mapoff);
  339.  #endif
  340. +#ifdef __linux__
  341. +extern void NDECL(linux_mapon);
  342. +extern void NDECL(linux_mapoff);
  343. +#endif
  344.  
  345.  static struct stat buf, hbuf;
  346.  
  347. @@ -313,6 +317,9 @@
  348.  #ifdef _M_UNIX
  349.      sco_mapon();
  350.  #endif
  351. +#ifdef __linux__
  352. +    linux_mapon();
  353. +#endif
  354.      if((f = fork()) == 0){        /* child */
  355.          (void) setgid(getgid());
  356.          (void) setuid(getuid());
  357. @@ -331,6 +338,9 @@
  358.      (void) wait( (int *) 0);
  359.  #ifdef _M_UNIX
  360.      sco_mapoff();
  361. +#endif
  362. +#ifdef __linux__
  363. +    linux_mapoff();
  364.  #endif
  365.      (void) signal(SIGINT, (SIG_RET_TYPE) done1);
  366.  #ifdef WIZARD
  367.